function [reg_map,reg_indices] = create_segmentation_hypothesis(image_gray,curr_group,curr_hypo,num_of_hypo_groups,hypo_amount)

% This function creates an hypothesis of image partition into regions. this function using 
% a different segmentation for each hypothesis, and in this way we get a deterministic hypotesis.

% Function Inputs:
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% image_gray - grayscale image matrix.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% curr_group - the current group number of hypothesises
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% curr_hypo - the current hypothesis from the group
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% num_of_hypo_groups - number of wanted hypothesis' groups.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% hypo_amount - number of wanted hypothesis.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Function Outputs:
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% reg_map - the region's map. 
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% reg_indices - cell of the region's indices, for further processing.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Global Inputs:
% segment_p.sigma
% segment_p.K_th
% segment_p.min_size
% segment_p.k_step
% segment_p.min_step

global segment_p

sigma=segment_p.sigma;
min_K_th=segment_p.K_th;
min_size=segment_p.min_size;
k_step=segment_p.k_step;
min_step=segment_p.min_step;

curr_K_th=min_K_th+(curr_hypo-1)*k_step;
curr_min_size=min_size+(curr_group-1)*min_size;

max_K_th=min_K_th+(hypo_amount-1)*k_step;
max_size=min_size+(num_of_hypo_groups-1)*min_size;

reg_map=segment_image(image_gray,sigma,curr_K_th,curr_min_size);

reg_num=length(unique(reg_map));
for i=1:reg_num
    reg_indices{1,i}=find(reg_map==i);
end
